﻿#ifndef WINMICRECORD_H
#define WINMICRECORD_H

#include "WinMediaDevice.h"
#include <Audioclient.h>

class WinMicRecord : public WinMediaDevice
{
    Q_OBJECT
public:
    explicit WinMicRecord(QObject *parent = nullptr);
    virtual ~WinMicRecord();


public:
    virtual IMMDevice *getDevice() override;

    virtual bool init() override;
    virtual bool capture() override;

public slots:
    virtual void run() override;

private:
    IAudioClient *      _AudioClient = NULL;
    IAudioCaptureClient *_CaptureClient = NULL;
    WAVEFORMATEX *      micFormat = NULL;
    HANDLE _AudioSamplesReadyEvent = NULL;
    BYTE *pBuffer = NULL;
    size_t _FrameSize = 0;
};

#endif // WINMICRECORD_H
